<?php

/**
 * If you are not authorized to modify this file, do NOT touch it.
 * @file nodb.class.php
 * @author deltamaster
 * @date 2011-3-22
 * @description This object do nothing but throwing exceptions when asked to access database. Use it when an application has no need to access a database.
 */

if (!defined('IN_IMBA')) exit('Access Denied.');

require_once (IMBA_LIB . 'database/database.class.php');

class NoDB implements Database
{

	public function __construct($configFile) {}
	
	public function __destruct() {}
	
	private function throw_exception()
	{
		try
		{
			throw new ImbaException(E_DB_NODB);
		}
		catch (ImbaException $e)
		{
			$e->IncludeExceptionHandlerStop();
		}
	}

	public function destroy_conn($id)
	{
		$this->throw_exception();
	}

	public function query($sql, $query = '')
	{
		$this->throw_exception();
	}

	public function free_result($query)
	{
		$this->throw_exception();
	}

	public function switch_conn($id)
	{
		$this->throw_exception();
	}

	public function create_new_conn($configFile)
	{
		$this->throw_exception();
	}

	public function fetch_array($query, $result_type = MYSQLI_ASSOC)
	{
		$this->throw_exception();
	}

	public function num_rows($query)
	{
		$this->throw_exception();
	}

	public function last_insert_id()
	{
		$this->throw_exception();
	}

}

?>